package com.cty.questions;
/*
* 反转链表(迭代)
*
* */
public class invert {
    public static ListNode invert(ListNode head) {
        ListNode cur = head;
        ListNode pre = null;
        ListNode next = null;
        while (cur != null) {
            next = cur.next;
            cur.next = pre;
            pre = cur;
            cur = next;
        }
        return pre;
    }
}
